import time

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()

driver.get("https://www.baidu.com")

time.sleep(3)
driver.find_element(By.LINK_TEXT, "新闻").click()
print(driver.title)

print(driver.window_handles[1])
driver.switch_to.window(driver.window_handles[1])
print(driver.title)
time.sleep(3)

time.sleep(3)
driver.quit()